home *** CD-ROM | disk | FTP | other *** search
/ Champak 120 / Vol 120.iso / games / titans / beastboy.swf / scripts / DefineSprite_288 / frame_1 / DoAction.as
Text File  |  2010-11-09  |  995b  |  56 lines

  1. range = 300;
  2. xs = 3;
  3. xmin = _X;
  4. xmax = _X + range;
  5. shootdelay = 15;
  6. d = shootdelay;
  7. spider.body.body.ca1.off = 1;
  8. spider.body.body.ca2.off = 0;
  9. onenterframe = function()
  10. {
  11.    _X = _X + xs;
  12.    if(_X > xmax)
  13.    {
  14.       _X = xmax;
  15.       xs = - xs;
  16.       spider.body.body.ca1.off = 0;
  17.       spider.body.body.ca2.off = 1;
  18.    }
  19.    else if(_X < xmin)
  20.    {
  21.       _X = xmin;
  22.       xs = - xs;
  23.       spider.body.body.ca1.off = 1;
  24.       spider.body.body.ca2.off = 0;
  25.    }
  26.    d--;
  27.    if(!d)
  28.    {
  29.       d = shootdelay;
  30.       if(math.abs(p._y - _Y) < 20)
  31.       {
  32.          if(math.abs(p._x - _X) < 600)
  33.          {
  34.             if(xs < 0 and p._x - _X < 0)
  35.             {
  36.                bulletlaunch(6);
  37.             }
  38.             else if(xs > 0 and p._x - _X > 0)
  39.             {
  40.                bulletlaunch(5);
  41.             }
  42.          }
  43.       }
  44.    }
  45.    cekhitattack(z);
  46.    if(die)
  47.    {
  48.       gotoAndPlay(4);
  49.    }
  50.    else
  51.    {
  52.       cekhitp(z2);
  53.    }
  54. };
  55. stop();
  56.